﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Acme.BookStore2
{
   /// <summary>
    /// 问答帖
    /// </summary>
    public class QuestionAndAnswerPost : FullAuditedAggregateRoot<Guid>
    {
        /// <summary>
        /// 标题
        /// </summary>
        public virtual string Title { get; protected set; }
        /// <summary>
        /// 描述
        /// </summary>
        public virtual string Description  { get; set; }
        /// <summary>
        /// 内容
        /// </summary>
        public virtual string Content { get; set; }
        /// <summary>
        /// 阅读次数
        /// </summary>
        public virtual int ReadCount { get; protected set; }
        /// <summary>
        /// 标签
        /// </summary>
        public virtual string Tags { get; set; }

        protected QuestionAndAnswerPost()
        {
            
        }
        
        public QuestionAndAnswerPost(Guid id, string title) : base(id)
        {
            Title = title;
        }

        public virtual QuestionAndAnswerPost IncreaseReadCount()
        {
            ReadCount++;
            return this;
        }
        
        public QuestionAndAnswerPost SetTitle(string title)
        {
            Title = Check.NotNullOrWhiteSpace(title, nameof(title));
            return this;
        }
    }
}